After completing this lesson, you’ll be able to:
The usual way to set an attribute value is with the AttributeCreator or AttributeManager, and these have an option in their drop-down menu to set a value to null:
Conditional Attributes functionality also supports setting <null>
values:
The way to handle bulk updates of attributes is with the NullAttributeMapper transformer.
The NullAttributeMapper transformer allows the author to check values for any or all attributes on a feature and convert them in bulk to or from null.
For example, here, the author is checking for attributes that are either missing or empty and converting them to nulls:
One reason for this might be that the workspace converts data from a format that does not support nulls to one that does. It's necessary to map the values explicitly here because empty/missing values may be permitted in the output. FME will not automatically map data from empty to null because a format supports it.
In this second example, the author checks attributes for existing null values. If the value is set to null, then it gets replaced with a zero:
Presumably, this must be a numeric field. If it were a text field, the author could set it to an empty string instead. Unlike before, the author wouldn't need to do this when converting from a format that supports null to a format that doesn't, because FME will map the values automatically when the current state isn't supported.
A better reason for this mapping is that the author wants to carry out a numeric calculation where zero is a valid number, but <null>
isn't.